package com.panopset.svg;

import java.awt.Canvas;
import java.awt.Graphics;
import java.awt.GridLayout;

import javax.swing.JComponent;
import javax.swing.JPanel;

import com.panopset.sf.Windoc;
import com.panopset.sf.apps.PanopsetApp;

/**
 * Scalable Vector Graphics proof of concept.
 *
 * @author Karl Dinwiddie
 *
 */
public class HelloSVG extends PanopsetApp {

    public static void main(final String... args) {
        new HelloSVG().show();
    }

    @Override
    public JComponent createPanel(Windoc w) {
        JPanel p = w.cf.createPanel(new GridLayout(1, 1));
        p.add(new Canvas() {
            @Override
            public void paint(final Graphics g) {
                g.drawImage(getCardsSVG().getDeckImage(), 0, 0, null);
            }
        });
        return p;
    }

    private CardsSVG cardsSVG;

    public CardsSVG getCardsSVG() {
        if (cardsSVG == null) {
            cardsSVG = new CardsSVG(100);
        }
        return cardsSVG;
    }
}
